#!/usr/bin/env jruby
# -*- coding: us-ascii -*-
# Elizabeth Wiethoff 2008

require 'pp' if $DEBUG
require 'time'

########################################

dir = File.dirname(__FILE__)
require File.join(dir, '..', '..', 'lib', 'superelse', 'outputbox')
data_file = ARGV.shift || File.join(dir, 'projects.tablepp.txt')

columns = [
  Hash[:title, 'GNo',       :width,  25, :column, 0, :type, Integer], 
  Hash[:title, 'Directory', :width, 175, :column, 1, :type, String], 
  Hash[:title, 'FileName',  :width, 175, :column, 2, :type, String], 
  Hash[:title, 'ModTime',   :width, 150, :column, 3, :type, Time], 
  Hash[:title, 'FileSize',  :width, 100, :column, 4, :type, Integer], 
  Hash[:title, 'GSz',       :width,  25, :column, 5, :type, Integer], 
]

data = [
  [1, '/Work',     'foo.txt',    '2007-12-20', 12345, 2], 
  [1, '/Projects', 'foobar.txt', '2007-05-13', 54321, 2], 
  [2, '/Projects', 'barbaz.txt', '2007-10-30',   987, 2], 
  [2, '/Work',     'bar.txt',    '2008-01-24',   654, 2], 
]

begin
  data = eval(File.open(data_file) { |f| f.read }) if data_file
rescue ; end

data.each { |row| row[3] = Time.parse row[3] }

mainFrame = launchOutputWindow(data, columns)
mainFrame.setDefaultCloseOperation(javax.swing.JFrame::EXIT_ON_CLOSE)
